/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tesoreria.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "tes_historial_descuento")
@NamedQueries({@NamedQuery(name = "HistorialDescuento.findAll", query = "SELECT h FROM HistorialDescuento h"), @NamedQuery(name = "HistorialDescuento.findByHdeCodigo", query = "SELECT h FROM HistorialDescuento h WHERE h.hdeCodigo = :hdeCodigo"), @NamedQuery(name = "HistorialDescuento.findByHdefecIni", query = "SELECT h FROM HistorialDescuento h WHERE h.hdefecIni = :hdefecIni"), @NamedQuery(name = "HistorialDescuento.findByHdefecFin", query = "SELECT h FROM HistorialDescuento h WHERE h.hdefecFin = :hdefecFin")})
public class HistorialDescuento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "hde_codigo", nullable = false)
    private Integer hdeCodigo;
    @Column(name = "hde_fecIni")
    @Temporal(TemporalType.DATE)
    private Date hdefecIni;
    @Column(name = "hde_fecFin")
    @Temporal(TemporalType.DATE)
    private Date hdefecFin;
    @JoinColumn(name = "cde_codigo", referencedColumnName = "cde_codigo")
    @ManyToOne(fetch = FetchType.LAZY)
    private ConfiguracionDescuento cdeCodigo;

    public HistorialDescuento() {
    }

    public HistorialDescuento(Integer hdeCodigo) {
        this.hdeCodigo = hdeCodigo;
    }

    public Integer getHdeCodigo() {
        return hdeCodigo;
    }

    public void setHdeCodigo(Integer hdeCodigo) {
        this.hdeCodigo = hdeCodigo;
    }

    public Date getHdefecIni() {
        return hdefecIni;
    }

    public void setHdefecIni(Date hdefecIni) {
        this.hdefecIni = hdefecIni;
    }

    public Date getHdefecFin() {
        return hdefecFin;
    }

    public void setHdefecFin(Date hdefecFin) {
        this.hdefecFin = hdefecFin;
    }

    public ConfiguracionDescuento getCdeCodigo() {
        return cdeCodigo;
    }

    public void setCdeCodigo(ConfiguracionDescuento cdeCodigo) {
        this.cdeCodigo = cdeCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (hdeCodigo != null ? hdeCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistorialDescuento)) {
            return false;
        }
        HistorialDescuento other = (HistorialDescuento) object;
        if ((this.hdeCodigo == null && other.hdeCodigo != null) || (this.hdeCodigo != null && !this.hdeCodigo.equals(other.hdeCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.tesoreria.be.HistorialDescuento[hdeCodigo=" + hdeCodigo + "]";
    }

}
